package br.com.toscano.gobra.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;


@Entity 
@Table(name="ESTADO")
public class Estado  extends ObjetoAbstrato {

	private static final long serialVersionUID = 13454534543354506L;

	public Object getValorDescricao() {
		return this.getUf();
	}

	public String getLabelAtributoDescricao() {return "U.F.";}public String getAtributoDescricao() {
		return "uf";
	}

	public Object getKey() {
		return this.getUf();
	}

	@Id
	@Column(name="ESTA_UF")
	private String uf;
	
	@Column(name="ESTA_DESCRICAO", nullable=false, length=255)
	private String descricao;
	
	public String getUf() {
		return uf;
	}
	public void setUf(String uf) {
		this.uf = uf;
	}
	public String getDescricao() {
		return descricao;
	}
	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}
	@Override
	public boolean equals(Object obj) {
		if (!(obj instanceof Estado)) {
			return false;
		}
		Estado e = (Estado)obj;
		if (this.uf != null && e.uf == null)
			return false;
		if (this.uf == null && e.uf != null)
			return false;
		if (this.uf == null && e.uf == null)
			return false;
			
		return e.uf.equals(this.uf);
		
	}
	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return (uf + "asdfa").hashCode();
	}
}